
;;remove bell, it's noising
(setq ring-bell-function 'ignore)

(global-auto-revert-mode t)

;;disable backup file , remove *.~ file .
(setq make-backup-files nil)

;;enable recentf-mode
(require 'recentf)
(recentf-mode 1)			
(setq recentf-max-menu-items 25)

;;show match parents
(add-hook 'emacs-lisp-mode-hook 'show-paren-mode)

;;Highlight current line (global-hl-line-mode)
(global-hl-line-mode t)

;;add delete selection mode
(delete-selection-mode t)


;;(setq-default truncate-lines t)
;;(setq-default cursor-type 'bar)
;;(toggle-truncate-lines t)


(defun indent-buffer()
  (interactive)
  (indent-region (point-min) (point-max)))

(defun indent-region-or-buffer()
  (interactive)
  (save-excursion
    (if (region-active-p)
	(progn
	  (indent-region (region-beginning) (region-end))
	  (message "Indent selected region."))
      (progn
	(indent-buffer)
	(message "Indent buffer.")))))

(setq hippie-expand-try-function-list '(try-expand-debbrev
					try-expand-debbrev-all-buffers
					try-expand-debbrev-from-kill
					try-complete-file-name-partially
					try-complete-file-name
					try-expand-all-abbrevs
					try-expand-list
					try-expand-line
					try-complete-lisp-symbol-partially
					try-complete-lisp-symbol))

(fset 'yes-or-no-p 'y-or-n-p)

(setq dired-recursive-deletes 'always)
(setq dired-recursive-copies 'always)

;;启用 dired-x 可以让每一次进入 Dired 模式时，使用新的快捷键 C-x C-j 就可以进 入当前文件夹的所在的路径。 
(require 'dired-x)

;;可以使当一个窗口（frame）中存在两个分屏 （window）时，将另一个分屏自动设置成拷贝地址的目标。 
(setq dired-dwin-target 1)


(provide 'init-better-defaults)
